package com.imooc.pay.enums;

import com.lly835.bestpay.enums.BestPayTypeEnum;
import lombok.Getter;

@Getter
public enum PayPlatFormEnum {

    ALIPAY(1),

    WX(2),
    ;

    Integer code;

    PayPlatFormEnum(Integer code) {
        this.code = code;
    }

    public static PayPlatFormEnum getByBestPayTypeEnum(BestPayTypeEnum bestPayTypeEnum) {
        for (PayPlatFormEnum payPlatFormEnum : PayPlatFormEnum.values()) {
            if (bestPayTypeEnum.getPlatform().name().equals(payPlatFormEnum.name())) {
                return payPlatFormEnum;
            }
        }
        throw new RuntimeException("错误的支付平台:" + bestPayTypeEnum.name());
    }

}
